Skip to content

[Dynamic Dashboard] Navigate to reviews details from reviews card #11503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 15, 2024

Conversation

hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented May 13, 2024

Closes: #11474

Description

This PR adds logic for navigating to the review details from the reviews card, please check the comments for more details on the approach.

Testing instructions

  1. Open the app.
  2. Make sure the reviews card is enabled in the dashboard.
  3. Click on one of the reviews.
  4. Confirm it opens the review details.
  5. Click on "Approve/Approved" to change the review's status.
  6. Go back to the dashboard by tapping on back twice.
  7. Confirm the review status was updated accordingly.

Images/gif

Screen_recording_20240513_171822.mp4
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@hichamboushaba hichamboushaba added type: enhancement A request for an enhancement. feature: dashboard Related to home screen project labels May 13, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 13, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
FlavorJalapeno
Build TypeDebug
Commit442c79f
Direct Downloadwoocommerce-prototype-build-pr11503-442c79f.apk

Comment on lines +91 to +102
// Open the review list screen first as it's responsible for handling review status changes
navController.navigateSafely(
DashboardFragmentDirections.actionDashboardToReviews()
)
// Continue to the details screen
navController.navigateSafely(
directions = DashboardFragmentDirections.actionGlobalReviewDetailFragment(
launchedFromNotification = false,
remoteReviewId = event.review.remoteId
),
skipThrottling = true
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ReviewListFragment is responsible for handling the undo logic of the reviews' operations (moderation and deletion), so to keep this logic while navigating from the reviews card, we needed to either:

  1. Implement the same logic at the dashboard level.
  2. Navigate to the list before showing the details.

For simplicity, I followed 2, and it works well, please let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice hack!

) : ScopedViewModel(savedStateHandle) {
companion object {
val supportedFilters = listOf(
ProductReviewStatus.ALL,
ProductReviewStatus.APPROVED,
ProductReviewStatus.HOLD,
ProductReviewStatus.SPAM
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As explained here p1715612834620439/1715264194.676369-slack-C03L1NF1EA3, supporting the spam filter will require more work, so let's remove it for now.

@hichamboushaba hichamboushaba requested a review from 0nko May 14, 2024 11:24
@hichamboushaba hichamboushaba marked this pull request as ready for review May 14, 2024 11:24
@hichamboushaba hichamboushaba added this to the 18.7 milestone May 14, 2024
@hichamboushaba hichamboushaba linked an issue May 14, 2024 that may be closed by this pull request
@hichamboushaba hichamboushaba force-pushed the issue/11474-dynamic-dashboard-reviews-card-3 branch from 50692ba to 442c79f Compare May 14, 2024 18:51
@codecov-commenter
Copy link

codecov-commenter commented May 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 50 lines in your changes are missing coverage. Please review.

Project coverage is 40.65%. Comparing base (67717c7) to head (442c79f).
Report is 60 commits behind head on trunk.

Files Patch % Lines
.../ui/dashboard/reviews/DashboardReviewsViewModel.kt 0.00% 32 Missing ⚠️
...droid/ui/dashboard/reviews/DashboardReviewsCard.kt 0.00% 18 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #11503      +/-   ##
============================================
- Coverage     40.67%   40.65%   -0.02%     
  Complexity     5180     5180              
============================================
  Files          1070     1070              
  Lines         62540    62569      +29     
  Branches       8557     8559       +2     
============================================
  Hits          25438    25438              
- Misses        34815    34844      +29     
  Partials       2287     2287              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hichamboushaba hichamboushaba added status: feature-flagged Behind a feature flag. Milestone is not strongly held. status: do not merge Dependent on another PR, ready for review but not ready for merge. labels May 14, 2024
@dangermattic
Copy link
Collaborator

dangermattic commented May 14, 2024

1 Warning
⚠️ This PR is assigned to the milestone 18.7. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@0nko 0nko self-assigned this May 15, 2024
Base automatically changed from issue/11474-dynamic-dashboard-reviews-card-2 to trunk May 15, 2024 18:08
@hichamboushaba hichamboushaba removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label May 15, 2024
Copy link
Contributor

@0nko 0nko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 🏅

Comment on lines +91 to +102
// Open the review list screen first as it's responsible for handling review status changes
navController.navigateSafely(
DashboardFragmentDirections.actionDashboardToReviews()
)
// Continue to the details screen
navController.navigateSafely(
directions = DashboardFragmentDirections.actionGlobalReviewDetailFragment(
launchedFromNotification = false,
remoteReviewId = event.review.remoteId
),
skipThrottling = true
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice hack!

@0nko 0nko merged commit 77d1c45 into trunk May 15, 2024
15 of 18 checks passed
@0nko 0nko deleted the issue/11474-dynamic-dashboard-reviews-card-3 branch May 15, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: dashboard Related to home screen project status: feature-flagged Behind a feature flag. Milestone is not strongly held. type: enhancement A request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dynamic Dashboard] Last 3 reviews card
5 participants